package com.sjksy.demo.controller;

import com.sjksy.demo.domain.CustomerInformation;
import com.sjksy.demo.service.CustomerInformationService;
import com.sjksy.demo.service.TravelMessageService;
import com.sjksy.demo.vo.customerInformation.CustomerResponseVo;
import com.sjksy.demo.vo.travel_message.TravelMessageVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/customer_information")
@Tag(name = "顾客相关接口",description = "处理顾客相关信息")
public class CustomerInformationController {
    @Resource
    private TravelMessageService travelMessageService;
    @Resource
    private CustomerInformationService customerInformationService;

    @GetMapping("/information")
    @Operation(summary = "获取供顾客选择的旅游信息")
          ResponseEntity<List<TravelMessageVo>> getInformation(){
        List<TravelMessageVo> list=travelMessageService.getInformation();
        return ResponseEntity.ok(list);
    }

    @PostMapping("/insert")
    @Operation(summary = "插入顾客信息和顾客选择的旅游信息id")
    ResponseEntity<String> insert(@RequestBody CustomerInformation customerInformation){
        customerInformationService.insert(customerInformation);
        return ResponseEntity.ok("插入成功");
    }


    @GetMapping("/all")
    @Operation(summary = "查询所有顾客信息")
    ResponseEntity<List<CustomerResponseVo>> getAll(){
        List<CustomerResponseVo> customerResponseVo=customerInformationService.getAll();
        return ResponseEntity.ok(customerResponseVo);
    }
}
